<div class="row">
    <div class="hpanel hgreen">
        <div class="panel-heading hbuilt">
            <div class="panel-tools">
                <a class="showhide"><i class="fa fa-chevron-up"></i></a>
            </div>
            客户预警信息
        </div>

        <div class="panel-body">
            <g:each in="${opportunityFlexFieldCategorys}">

                <g:if test="${it?.flexFieldCategory?.name in ['准入警示信息']}">
                    <div class="form form-horizontal">

                        <div class="form-group">
                            <label class="col-md-2 control-label">${it?.flexFieldCategory?.name}：</label>

                            <div class="col-md-10">
                                <g:each in="${it?.fields}" var="field">
                                    <span class="cont text-comment">${field?.name}:${field?.value}</span>

                                </g:each>
                            </div>
                        </div>

                    </div>
                </g:if>

            </g:each>
        </div>
    </div>
</div>
<style>
    #baseData>div{
        margin-left: 10px;
    }
    #baseData>div:first-child{
        margin-left: 0;
    }
    .formAddBtn{
        color: #000;
        border: 1px solid #3498db;
        margin-left: 20px;
        margin-top: 10px;
        background-color: transparent;
        transition: all .5s;display: inline-block;
        padding: 6px 12px;
        margin-bottom: 0;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.42857143;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        background-image: none;
        border-radius: 4px;

    }
    .formAddBtnActive{
        background-color: #4ea5e0;
        color: #fff;
    }
</style>
<div class="row">
    <div class="hpanel hgreen ">
        <div class="panel-heading hbuilt">
            <div class="panel-tools">
                <a class="showhide"><i class="fa fa-chevron-up"></i></a>
            </div>
            授信决策信息
        </div>

        <div class="panel-body">
            <g:each in="${opportunityFlexFieldCategorys}">

                <g:if test="${it?.flexFieldCategory?.name in ['额度测算结果']}">
                    <div class="form form-horizontal">

                        <div class="form-group">
                            <label class="col-md-2 control-label">${it?.flexFieldCategory?.name}：</label>

                            <div class="col-md-10">
                                <g:each in="${it?.fields}" var="field">
                                    <div style="margin-bottom: 20px;">
                                        <div style="float: left">
                                            <span class="cont text-comment">${field?.name}:<span style="font-weight: bold;font-size: 18px;color: red;">${field?.value}</span> <span style="color: red;">总费率：${field.defaultValue?field.defaultValue?.toDouble()*100:0}%/${opportunity?.loanDuration}期</span></span>
                                            <div style="display: flex" id="baseData">
                                                <div>基础材料要求：</div>
                                                <g:each var="f" in="${field.values}">
                                                    <span class="mate-item">${f.value}</span>
                                                </g:each>
                                            </div>
                                        </div>
                                        %{--<button style="color: #000 !important;border: 1px solid #3498db;margin-left: 20px;margin-top: 10px;" type="button" onclick="info(${field?.id},${this?.opportunity?.id},${field?.value},${field.defaultValue?field.defaultValue?.toDouble()*100:0},${opportunity?.loanDuration})"
                                                class="btn btn-outline btn-info">确认</button>--}%
                                        <button type="button" class="formAddBtn" onclick="info(this,${field?.id},${this?.opportunity?.id},${field?.value},${field.defaultValue?field.defaultValue?.toDouble()*100:0},${opportunity?.loanDuration})">确认</button>
                                    </div>

                                </g:each>
                            </div>
                        </div>

                    </div>
                </g:if>

            </g:each>
        </div>
    </div>
</div>
<script>
    function info(self,fieldId,id,value,dvalue,qishu) {
        $(self).addClass('formAddBtnActive');
        $(self).parent().siblings().children('button').removeClass('formAddBtnActive');
        $.ajax({
            url: "/remoteSignFace/successfulListSave",
            type: "post",
            data: {"fieldId":fieldId,"id":id},
            success: function (data) {
                alert(data)
                //todo 修改按钮颜色 修改表单字段
                $('#requestedAmount').val(value);
                $('#commissionRateTemp').val(dvalue);
                $('#loanDuration').val(qishu);
            }
        })
    }
</script>